/* 公共接口 */
import { request } from '@/utils/request';
// import { stringify } from 'qs';
import { getServiceHeaders } from '@/utils/common';

// POST 上传
export async function queryUpload(data?:any , progressFn?:any) {
  return request(`/plat/public/service/upload`, {
    method: 'POST',
    headers: {
      ...getServiceHeaders(),
      'Content-Type': 'multipart/form-data',
      // 'Request-Tk': localStorage.getItem('token-test') || null
    },
    data,
    onUploadProgress: progressEvent => {
      progressFn && progressFn(progressEvent.loaded / progressEvent.total * 100)
    }
  });
}